﻿using System.Collections.Generic;
using CI.Organism;
using CI.WebService;

namespace CI.Interfaces
{
    /// <summary>
    /// Scenario
    /// </summary>
    public interface IScenario
    {
        /// <summary>
        /// Scene name
        /// Used in DAL name used to load and save
        /// </summary>    
        string ScenarioName { get; set; }

        /// <summary>
        /// Manifest file
        /// </summary>
        string ManifestFile { get; set; }

        /// <summary>
        /// Version of Hosting Environment
        /// </summary>
        string HostingEnvironmentVersionInformation { get; }

        /// <summary>
        /// Scene Description
        /// </summary>
        string ScenarioDescription { get; set; }

        #region Boundrys
        /// <summary>Max X radius boundry</summary>
        float BoundryXRadiusMax
        {
            get;
            set;
        }

        /// <summary>Max Y radius boundry</summary>
        float BoundryYRadiusMax
        {
            get;
            set;
        }

        /// <summary>Max Z radius boundry</summary>
        float BoundryZRadiusMax
        {
            get;
            set;
        }
        #endregion

        /// <summary>Fitness function for the environment</summary>   
        string FitnessFunction { get; set; }

        /// <summary>Simulation environment</summary>
        string SimulationRestrictions { get; set; }

        /// <summary>
        /// max number to load from the dal for the scenario
        /// </summary>
        int MaxLoadCount { get; set; }

        /// <summary>
        /// max number to save to the dal for the scenario
        /// </summary>
        int MaxSaveCount { get; set; }

        /// <summary>
        /// List of required entitys
        /// </summary>
        List<IScenarioEntityRequirements> RequiredOrganisms { get; set; }

        /// <summary>
        /// Fall back list of Enitys in the scenario eg, Amoeba, iRobot in case the resources in the resource file arent enough
        /// </summary>
        List<IOrganism> FallBackOrganisms { get; set; }

        /// <summary>
        /// Entity organisms loaded through DAL
        /// </summary>
        IDAL ExternalOrganisms { get; set; }

        /// <summary>
        /// Load a scenario into the current class
        /// </summary>
        void Load();

        /// <summary>
        /// Save the scenario
        /// </summary>
        void Save();

        /// <summary>
        /// Compare what we loaded in with the DAL compared to what the 
        /// scenario requirements are in the requirements
        /// 
        /// Set all the organisms at their location specfied in the requirements
        /// </summary>
        SynchronizedCollection<IOrganism> CompareEnvironmentUpdateRequirements(IOrganismCollection organisms, IHostingEnvironment hostingEnvironment);

        /// <summary>
        /// get list of available scenarios
        /// </summary>
        /// <returns></returns>
        IEnumerable<string> GetScenariosAvailable();

        /// <summary>
        /// get the sceanrio's organisms
        /// </summary>
        /// <param name="scenarioName"></param>
        /// <param name="startIndex"></param>
        /// <param name="endIndex"></param>
        ScenarioOrganismCollection GetScenarioOrganisms(string scenarioName, int startIndex, int endIndex);

        /// <summary>
        /// see if all the values in the objects(not the objects) are equal
        /// selective  comparisions
        /// </summary>
        /// <param name="scenario">scenario to comare against</param>
        /// <returns>true if the same values</returns>
        bool EqualsValueTypes(IScenario scenario);
    }
}